package com.example.pages;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;


public class UserPage extends InternalPage {
    @FindBy(id = "email")
    public WebElement emailField;

    @FindBy(name = "submit")
    public WebElement saveButton;

    @FindBy(id = "password")
    public WebElement passwordField;

    @FindBy(name = "password2")
    public WebElement passwordField2;


    public UserPage changePassword(String newPass) {
        passwordField.clear();
        passwordField.sendKeys(newPass);
        passwordField2.clear();
        passwordField2.sendKeys(newPass);
        saveButton.click();
        return MyPageFactory.getPage(driver, UserPage.class);
    }

    public UserPage changeEmail(String email) {
        emailField.clear();
        emailField.sendKeys(email);
        saveButton.click();
        return MyPageFactory.getPage(driver, UserPage.class);
    }



}
